package traveler.controllers;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapController;

import android.app.Activity;
import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

public class GoogleMapsController extends BaseController implements View.OnClickListener, LocationListener
{
	public final static String LATITUDE = "latitude";
	public final static String LONGITUDE = "longitude";
	private MapController _mapController;
	
	public GoogleMapsController(Activity activity, MapController mapController)
	{
		super(activity);
		
		_mapController = mapController;
	}

	public void onClick(View v) {
		Log.i("GoogleMapsController", "OnClick - START ");

		switch (v.getId()) {
		case 1:

			break;
		case 2:

			break;
		}

		Log.i("GoogleMapsController", "OnClick - END ");
	}
	
	public void onLocationChanged(Location location)
	{
		double latitude = location.getLatitude();
		double longitude = location.getLongitude();
		GeoPoint geoPoint = new GeoPoint((int) (latitude * 1E6), (int) (longitude * 1E6));
		Log.i("GeoPoint", geoPoint + "");
		_mapController.animateTo(geoPoint);
		_mapController.setCenter(geoPoint);
	}
	
	public void onStatusChanged(String provider, int status, Bundle extras)
	{
		
	}

	public void onProviderEnabled(String provider)
	{
		
	}

	public void onProviderDisabled(String provider)
	{
		
	}
}
